package com.itheima.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc;

/**
 * @author : sky
 * @date : 2023/3/2 16:16
 * @modyified By :
 */

@Configuration
@EnableSwagger2WebMvc
public class Knife4jConfiguration {

    @Bean
    public Docket docket(){
        Docket docket=new Docket(DocumentationType.SWAGGER_2)
                //项目
                .apiInfo(getInfo())
                .pathMapping("/")
                .enable(true)
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.itheima"))
                //到config之前的包名
                .build();
        return docket;
    }


    private ApiInfo getInfo(){
        Contact contact=new Contact("sky",null,"1006236572@qq.com");

        return new ApiInfoBuilder()
                .title("瑞吉点餐")
                .description("移动端理系统")
                .contact(contact)
                .version("1.0").build();
    }
}